/*
* Copyright 2003-2010 Tufts University  Licensed under the
 * Educational Community License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License. You may
 * obtain a copy of the License at
 * 
 * http://www.osedu.org/licenses/ECL-2.0
 * 
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an "AS IS"
 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
package tufts.vue;



import java.awt.Component;
import java.awt.Window;

import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
import org.apache.log4j.WriterAppender;
import org.xml.sax.InputSource;

import tufts.Util;

import edu.tufts.vue.compare.ui.MergeMapsControlPanel;
import edu.tufts.vue.dsm.impl.VueDataSourceManager;
import edu.tufts.vue.preferences.implementations.MetadataSchemaPreference;
import edu.tufts.vue.preferences.implementations.ShowAgainDialog;
import edu.tufts.vue.preferences.implementations.WindowPropertiesPreference;

import javax.swing.JFrame;
import javax.swing.plaf.ProgressBarUI;

/**
 * Vue application class.
 * Create an application frame and layout all the components
 * we want to see there (including menus, toolbars, etc).
 *
 * @version $Revision: 1.714 $ / $Date: 2010-02-03 19:17:40 $ / $Author: mike $ 
 */

public class VUE implements VueConstants
{
//	public static LsFunction mlsfunction = new LsFunction(); //+ls@150217;
	
    public static final boolean VUE3 = true;
    
    public static boolean BLOCKING_OSID_LOAD = edu.tufts.vue.dsm.impl.VueDataSourceManager.BLOCKING_OSID_LOAD;
    
    /** This is the root logger for all classes named tufts.* */
    private static final Logger TuftsLog = Logger.getLogger("tufts");
    /** This is the root logger for all classes named edu.tufts.* */
    private static final Logger EduTuftsLog = Logger.getLogger("edu.tufts");

    private static final Logger Log = Logger.getLogger(VUE.class);
    private static JFrame ApplicationFrame;
        
    public static boolean isApplet() {
//    	if (VueApplet.getInstance() !=null)
//    		return VueApplet.getInstance().getAppletContext() != null;
//    	else
    		return false;
      //  return sAppletContext != null;
    }
    public static String getSystemProperty(String name) {
        // If we're an applet, System.getProperty will throw an AccessControlException
        //if (false && isApplet())
        //    return null;
        //else {
            String prop;
            try {
                prop = System.getProperty(name);
                if (DEBUG.INIT) Log.debug("fetched system property " + name + "=[" + prop + "]");
            } catch (java.security.AccessControlException e) {
                System.err.println(e);
                prop = null;
            }
            return prop;
       // }
    }
    public static boolean isSystemPropertyTrue(String name) {
        String value = getSystemProperty(name);
        return value != null && value.toLowerCase().equals("true");
    }
    
    public static boolean hasSystemProperty(String name) {
        return getSystemProperty(name) != null;
    }
	public static Window getMainWindow() {
		// TODO Auto-generated method stub
		return ApplicationFrame;
	}
	public static void invokeAfterAWT(Runnable runnable) {
	    java.awt.EventQueue.invokeLater(runnable);
	}
	public static Component getApplicationFrame() {
		// TODO Auto-generated method stub
		return ApplicationFrame;
	}
}
